/* Forest Green - Natural Fresh Theme */
:root {
    --theme-color: #059669;
    --theme-color-2: #10b981;
    --theme-color-3: #34d399;
    --theme-color-4: #6ee7b7;
    --theme-accent: #f59e0b;
    --theme-rgb: 5, 150, 105;
    --theme-2-rgb: 16, 185, 129;
    --theme-3-rgb: 52, 211, 153;
    --theme-4-rgb: 110, 231, 183;

    --text: #1e293b;
    --muted: #64748b;
    --surface: #ffffff;
    --surface-2: #f0fdf4;
    --border: #d1fae5;
    --shadow-sm: 0 4px 12px rgba(5, 150, 105, 0.08);
    --shadow: 0 8px 24px rgba(5, 150, 105, 0.12);
    --shadow-color: 0 12px 32px rgba(var(--theme-rgb), 0.15);

    --radius-lg: 20px;
    --radius-md: 14px;
    --radius-sm: 10px;
}

html,
body {
    height: 100%;
}

body {
    padding: 0;
    margin: 0;
    color: var(--text);
    background-color: #f0fdfa;
    background-image:
        radial-gradient(900px circle at 15% 15%, rgba(5, 150, 105, 0.06), transparent 55%),
        radial-gradient(700px circle at 85% 85%, rgba(16, 185, 129, 0.05), transparent 50%),
        radial-gradient(500px circle at 60% 40%, rgba(52, 211, 153, 0.04), transparent 45%),
        linear-gradient(180deg, #f0fdfa 0%, #f0fdf4 50%, #ecfdf5 100%);
    background-attachment: fixed;
    font-family: "Plus Jakarta Sans", "Inter", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
    line-height: 1.6;
}

img {
    max-width: 100%;
    height: auto;
}

a {
    color: var(--theme-color);
    transition: color 0.2s ease;
}

a:hover,
a:focus {
    color: var(--theme-color-2);
    text-decoration: none;
}

h1,
h2,
h3,
.page-header h1,
.navbar-inverse .navbar-brand {
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text);
}

@keyframes leaf-sway {
    0%, 100% {
        transform: rotate(-2deg);
    }
    50% {
        transform: rotate(2deg);
    }
}

@keyframes fresh-fade {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Navbar */
.navbar-inverse {
    background: #ffffff;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.navbar-inverse .navbar-brand {
    color: var(--text);
    font-weight: 700;
}

.navbar-inverse .navbar-brand:focus,
.navbar-inverse .navbar-brand:hover {
    color: var(--theme-color);
}

.navbar-inverse .navbar-nav>li>a {
    color: var(--muted);
    font-weight: 600;
    border-radius: 999px;
    padding: 10px 16px;
    transition: all 0.2s ease;
}

.navbar-inverse .navbar-nav>li>a:focus,
.navbar-inverse .navbar-nav>li>a:hover {
    color: var(--text);
    background: var(--surface-2);
    border: 1px solid var(--border);
}

@media (min-width: 768px) {
    .navbar-inverse .navbar-nav>li {
        margin-left: 6px;
    }

    .navbar-inverse .navbar-nav>li>a {
        padding: 10px 14px;
    }
}

/* Buttons */
.btn {
    border-radius: var(--radius-md);
    padding: 10px 20px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.btn:active {
    transform: translateY(1px);
}

.btn-flat {
    border-radius: var(--radius-md);
}

.btn-primary {
    background: linear-gradient(135deg, var(--theme-color), var(--theme-color-2));
    border: 1px solid var(--theme-color);
    color: #fff;
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.25);
}

.btn-primary:hover,
.btn-primary:focus {
    background: linear-gradient(135deg, var(--theme-color-2), var(--theme-color-3));
    border-color: var(--theme-color-2);
    box-shadow: 0 8px 16px rgba(5, 150, 105, 0.3);
    transform: translateY(-2px);
}

.btn-default {
    background: #ffffff;
    border: 1px solid var(--border);
    color: var(--text);
}

.btn-default:hover,
.btn-default:focus {
    background: var(--surface-2);
    border-color: var(--theme-color);
    color: var(--text);
}

.btn-success {
    background: linear-gradient(135deg, #059669, #10b981);
    border: 1px solid #059669;
    color: #fff;
}

.btn-success:hover,
.btn-success:focus {
    background: linear-gradient(135deg, #10b981, #34d399);
    transform: translateY(-2px);
}

.btn-info {
    background: linear-gradient(135deg, #0ea5e9, #0284c7);
    border: 1px solid #0ea5e9;
    color: #fff;
}

.btn-info:hover,
.btn-info:focus {
    background: linear-gradient(135deg, #0284c7, #0ea5e9);
    transform: translateY(-2px);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    border: 1px solid #ef4444;
    color: #fff;
}

.btn-danger:hover,
.btn-danger:focus {
    background: linear-gradient(135deg, #dc2626, #ef4444);
    transform: translateY(-2px);
}

/* Forms */
.form-control {
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    box-shadow: none;
    height: 42px;
    background-color: #ffffff;
    color: var(--text);
    transition: all 0.2s ease;
}

.form-control:focus {
    border-color: var(--theme-color);
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.12), 0 4px 12px rgba(5, 150, 105, 0.1);
    background-color: #ffffff;
}

textarea.form-control {
    height: auto;
}

/* Card layout */
.user_center {
    background: transparent;
    border: 0;
    border-radius: 0;
    margin-top: 24px;
    margin-bottom: 24px;
    box-shadow: none;
}

@media (min-width: 768px) {
    .user_center {
        display: flex;
        align-items: flex-start;
        gap: 20px;
        margin-left: 0;
        margin-right: 0;
    }

    .user_center>.sidebar,
    .user_center>.main {
        float: none;
    }

    .user_center>.sidebar {
        flex: 0 0 260px;
        max-width: 260px;
    }

    .user_center>.main {
        flex: 1 1 auto;
        width: auto;
    }
}

.sidebar {
    overflow: hidden;
    padding: 20px;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    position: sticky;
    top: 20px;
}

.sidebar-profile {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    margin: 0 0 16px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.sidebar-avatar {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--theme-color), var(--theme-color-2));
    box-shadow: 0 8px 20px rgba(5, 150, 105, 0.25);
}

.sidebar-profile-meta {
    min-width: 0;
}

.sidebar-profile-title {
    font-size: 11px;
    color: var(--muted);
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.sidebar-profile-subtitle {
    margin-top: 4px;
    font-size: 14px;
    color: var(--text);
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.main {
    padding: 24px;
    min-height: 600px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: #ffffff;
    box-shadow: var(--shadow);
    font-size: 14px;
    line-height: 1.7;
}

.main p {
    margin: 12px 0;
    color: var(--muted);
}

.page-header {
    margin: 0 0 20px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 16px;
}

.page-header h1 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

/* Sidebar navigation */
.nav-sidebar {
    margin: 0;
    padding: 0;
}

.nav-sidebar>li {
    margin: 0 0 6px 0;
}

.nav-sidebar>li>a {
    padding: 12px 14px;
    border-radius: var(--radius-md);
    color: var(--muted);
    font-weight: 600;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-sidebar>li>a:before {
    content: "";
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--theme-color-4);
    transition: all 0.2s ease;
}

.nav-sidebar>li>a:hover,
.nav-sidebar>li>a:focus {
    background: var(--surface-2);
    color: var(--text);
    transform: translateX(4px);
}

.nav-sidebar>li>a:hover:before,
.nav-sidebar>li>a:focus:before {
    background: var(--theme-color-2);
    transform: scale(1.1);
}

.nav-sidebar>.active>a,
.nav-sidebar>.active>a:hover,
.nav-sidebar>.active>a:focus {
    color: #fff;
    background: linear-gradient(135deg, var(--theme-color), var(--theme-color-2));
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.25);
}

.nav-sidebar>.active>a:before {
    background: rgba(255, 255, 255, 0.9);
    transform: scale(1.2);
}

/* Tabs */
.nav-tabs {
    border-bottom: 1px solid var(--border);
}

.nav-tabs>li>a {
    border: 0 !important;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    color: var(--muted);
    font-weight: 600;
    padding: 12px 18px;
    background: transparent;
    transition: all 0.2s ease;
}

.nav-tabs>li>a:hover {
    background: var(--surface-2);
    color: var(--text);
}

.nav-tabs>li.active>a,
.nav-tabs>li.active>a:hover,
.nav-tabs>li.active>a:focus {
    color: var(--text);
    background: transparent;
    border-bottom: 3px solid var(--theme-color) !important;
    margin-bottom: -1px;
}

.tab-content {
    padding: 20px 0 0;
}

/* Custom input groups */
.dd_input_group {
    padding: 12px 0;
}

.dd_input_l {
    padding: 10px 14px;
    height: 42px;
    line-height: 22px;
    border-width: 1px;
    border-style: solid;
    border-radius: var(--radius-md) 0 0 var(--radius-md);
    text-align: center;
    background-color: var(--surface-2);
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    box-sizing: border-box;
    border-color: var(--border);
    margin: 0;
    border-right: 0;
    font-weight: 700;
    color: var(--muted);
}

.dd_input_2 {
    padding: 0;
}

.dd_input_2 input {
    width: 100% !important;
}

.dd_input_group .dd_radio_lable_left {
    box-sizing: border-box;
    border-width: 1px;
    border-style: solid;
    border-color: var(--border);
    border-radius: var(--radius-md);
    padding: 7px 12px;
    height: 42px;
    overflow: hidden;
    background: var(--surface-2);
}

.dd_input_3 label {
    line-height: 28px;
    margin-right: 14px;
}

.dd_input_group input,
.dd_input_group select,
.dd_input_group textarea {
    height: 42px;
    line-height: 1.3;
    border-width: 1px;
    border-style: solid;
    background-color: #ffffff;
    border-radius: var(--radius-md);
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    border-color: var(--border);
    color: var(--text);
}

.form-group {
    width: 100%;
}

/* Legacy pages without .form-control */
.main input[type="text"]:not(.form-control),
.main input[type="number"]:not(.form-control),
.main input[type="password"]:not(.form-control),
.main input[type="email"]:not(.form-control),
.main select:not(.form-control),
.main textarea:not(.form-control) {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    height: 42px;
    background-color: #ffffff;
    color: var(--text);
    transition: all 0.2s ease;
}

.main input[type="text"]:not(.form-control):focus,
.main input[type="number"]:not(.form-control):focus,
.main input[type="password"]:not(.form-control):focus,
.main input[type="email"]:not(.form-control):focus,
.main select:not(.form-control):focus,
.main textarea:not(.form-control):focus {
    outline: none;
    border-color: var(--theme-color);
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.12);
    background-color: #ffffff;
}

/* Box (used in user_fabu) */
.box {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.box.box-body {
    padding: 20px;
}

/* Login panel */
.login {
    position: relative;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow);
    margin-top: 40px;
}

.login::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(400px circle at 0 0, rgba(5, 150, 105, 0.05), transparent 60%);
    pointer-events: none;
}

.login>* {
    position: relative;
    z-index: 1;
}

.login-description {
    font-size: 24px;
    line-height: 1.2;
    margin-bottom: 24px;
    color: var(--text);
    font-weight: 700;
}

.login-description p {
    font-size: 14px;
    color: var(--muted);
    margin-top: 12px;
}

.login .form-control {
    padding: 12px 14px;
    border-radius: var(--radius-md);
    font-weight: 400;
    font-size: 14px;
    height: 44px;
}

.login .form-group {
    margin-bottom: 20px;
}

.login .message_code input {
    width: 66%;
    float: left;
}

.login .message_code img {
    max-width: 32%;
    max-height: 44px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
}

/* Footer */
.copyrights {
    text-indent: -9999px;
    height: 0;
    line-height: 0;
    font-size: 0;
    overflow: hidden;
}

#footer {
    text-align: center;
    background: #ffffff;
    color: var(--muted);
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 14px 10px;
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 12px rgba(5, 150, 105, 0.05);
}

#footer a {
    color: var(--muted);
    font-weight: 600;
}

#footer a:hover {
    color: var(--theme-color);
    text-decoration: none;
}

#footer .t {
    margin: 0 0 6px;
}

#footer .foot-icp {
    font-size: 12px;
    line-height: 1.6;
    opacity: 0.9;
}

@media (max-width: 768px) {
    body {
        padding-top: 60px;
        padding-bottom: 100px;
    }

    .navbar-nav>li {
        float: left;
    }

    .navbar-nav {
        float: right;
    }

    .navbar-header {
        float: left;
    }

    .sidebar {
        border-right: 0;
        padding: 16px;
        position: static;
        margin-bottom: 16px;
    }

    .main {
        padding: 18px 16px 60px;
    }
}

/* Table & badges */
.table>thead>tr>th {
    border-bottom: 1px solid var(--border);
    color: var(--muted);
    font-weight: 700;
    background: var(--surface-2);
}

.table>tbody>tr>td {
    border-top: 1px solid var(--border);
    background: #ffffff;
}

.table-hover>tbody>tr:hover {
    background: var(--surface-2);
}

.label {
    border-radius: 999px;
    padding: .35em .75em;
    font-weight: 700;
    letter-spacing: 0.02em;
    display: inline-block;
}

.label-success {
    background: rgba(5, 150, 105, 0.12);
    color: #059669;
    border: 1px solid rgba(5, 150, 105, 0.25);
}

.label-warning {
    background: rgba(245, 158, 11, 0.12);
    color: #d97706;
    border: 1px solid rgba(245, 158, 11, 0.25);
}

.label-danger {
    background: rgba(239, 68, 68, 0.12);
    color: #dc2626;
    border: 1px solid rgba(239, 68, 68, 0.25);
}

/* Portal body - remove default padding */
body.portal-body {
    padding: 0;
    background-color: #f0fdfa;
}

/* Portal layout - Forest Green Style */
.portal-shell {
    width: min(1400px, 100%);
    max-width: 1400px;
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    grid-template-rows: auto 1fr;
    gap: 24px;
    align-items: start;
    margin: 24px auto 40px;
    padding: 0 24px;
}

.portal-header {
    grid-column: 1 / -1;
    grid-row: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 24px;
    border-radius: var(--radius-lg);
    background: #ffffff;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.portal-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.portal-logo {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
    letter-spacing: -0.01em;
}

.portal-logo:hover,
.portal-logo:focus {
    color: var(--theme-color);
}

.portal-tag {
    font-size: 12px;
    color: var(--muted);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    font-weight: 600;
}

.portal-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.portal-user {
    padding: 8px 16px;
    border-radius: 999px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
    font-weight: 600;
}

.portal-logout {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    color: var(--text);
    font-weight: 600;
    background: #ffffff;
    transition: all 0.2s ease;
}

.portal-logout:hover,
.portal-logout:focus {
    background: var(--surface-2);
    border-color: var(--theme-color);
    color: var(--text);
    text-decoration: none;
    transform: translateY(-2px);
}

.portal-rail {
    grid-column: 1;
    grid-row: 2;
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: sticky;
    top: 24px;
    padding: 20px;
    border-radius: var(--radius-lg);
    background: #ffffff;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.portal-rail-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.portal-rail-avatar {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--theme-color), var(--theme-color-2));
    box-shadow: 0 8px 20px rgba(5, 150, 105, 0.25);
}

.portal-rail-meta {
    min-width: 0;
}

.portal-rail-title {
    color: var(--muted);
    font-size: 11px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    font-weight: 600;
}

.portal-rail-subtitle {
    color: var(--text);
    margin-top: 4px;
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.portal-nav {
    border-radius: 0;
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
}

.portal-nav-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.portal-nav-item a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    background: transparent;
    color: var(--muted);
    font-weight: 600;
    transition: all 0.2s ease;
}

.portal-nav-item a::before {
    content: "";
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--theme-color-4);
    transition: all 0.2s ease;
}

.portal-nav-item a:hover,
.portal-nav-item a:focus {
    background: var(--surface-2);
    border-color: var(--border);
    color: var(--text);
    transform: translateX(4px);
}

.portal-nav-item a:hover::before,
.portal-nav-item a:focus::before {
    background: var(--theme-color-2);
    transform: scale(1.1);
}

.portal-nav-item.is-active a {
    background: linear-gradient(135deg, var(--theme-color), var(--theme-color-2));
    color: #fff;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.25);
}

.portal-nav-item.is-active a::before {
    background: rgba(255, 255, 255, 0.9);
    transform: scale(1.2);
}

.portal-main {
    grid-column: 2;
    grid-row: 2;
    min-width: 0;
}

.portal-panel {
    padding: 28px 32px 52px;
    min-height: 520px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: #ffffff;
    box-shadow: var(--shadow);
}

body.portal-body .page-header {
    margin: 0 0 20px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 16px;
}

body.portal-body .page-header h1 {
    font-weight: 700;
    font-size: 20px;
}

body.portal-body #footer {
    position: relative;
    max-width: 1400px;
    margin: 24px auto 0;
    padding: 16px 20px;
    border-radius: var(--radius-lg);
    background: #ffffff;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

body.portal-body #footer .t {
    margin: 0 0 6px;
}

@media (max-width: 1024px) {
    .portal-shell {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto 1fr;
    }

    .portal-header,
    .portal-rail,
    .portal-main {
        grid-column: 1;
    }

    .portal-rail {
        position: static;
    }
}

@media (max-width: 768px) {
    .portal-shell {
        padding: 0 16px 28px;
    }

    .portal-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .portal-actions {
        width: 100%;
        flex-wrap: wrap;
    }

    .portal-panel {
        padding: 20px 18px 44px;
    }
}

/* Radio and checkbox styling */
input[type="radio"],
input[type="checkbox"] {
    accent-color: var(--theme-color);
}

.radio-inline,
.checkbox-inline {
    padding-left: 24px;
    position: relative;
    display: inline-block;
    margin-right: 16px;
}

.radio-inline input[type="radio"],
.checkbox-inline input[type="checkbox"] {
    position: absolute;
    left: 0;
    top: 3px;
}

/* Help text styling */
.help-block {
    color: var(--muted);
    font-size: 13px;
    margin-top: 6px;
}

/* Row and column adjustments */
.row {
    margin-left: -8px;
    margin-right: -8px;
}

.row .col-sm-1,
.row .col-sm-2,
.row .col-sm-3,
.row .col-sm-4,
.row .col-sm-5,
.row .col-sm-6,
.row .col-sm-7,
.row .col-sm-8,
.row .col-sm-9,
.row .col-sm-10,
.row .col-sm-11,
.row .col-sm-12,
.row .col-xs-1,
.row .col-xs-2,
.row .col-xs-3,
.row .col-xs-4,
.row .col-xs-5,
.row .col-xs-6,
.row .col-xs-7,
.row .col-xs-8,
.row .col-xs-9,
.row .col-xs-10,
.row .col-xs-11,
.row .col-xs-12 {
    padding-left: 8px;
    padding-right: 8px;
}

/* Control label styling */
.control-label {
    color: var(--muted);
    font-weight: 600;
}
